import { ResponseData } from '@/API/user/type.js'

export interface HasSpuResponseData extends ResponseData {
  data: Spu
}
export interface ReqNullResponseData extends ResponseData {
  data: null
}

export type Spu = SpuData[]
export interface SpuData {
  current: number
  hitCount: boolean
  pages: number
  records: SpuRecord
  searchCount: boolean
  size: number
  total: number
}
export type SpuRecord = SpuRecordData[]

export interface SpuRecordData {
  category3Id?: number | string
  createTime?: string
  description: string
  //品牌的专属ID
  id?: number
  spuName: string
  spuImageList?: SpuImageList[] | null
  spuPosterList?: SpuImageList[] | null
  spuSaleAttrList?: SpuSaleAttrList[] | null
  tmId: number | string
  updateTime?: string
}

export interface SpuSaleAttrList {
  baseSaleAttrId?: number
  createTime?: string
  id?: number
  saleAttrName?: string
  spuId?: number
  spuSaleAttrValueList?: SpuSaleAttrValueList[]
  updateTime?: string
}

export interface SpuSaleAttrValueList {
  baseSaleAttrId: number
  createTime?: string
  id?: number
  isChecked?: string
  saleAttrName: string
  saleAttrValueName?: string
  spuId: number
  updateTime?: string
}

export interface SpuImageList {
  createTime?: string
  id?: number
  imgName?: string
  imgUrl?: string
  spuId?: number
  updateTime?: string
}

export interface HasAllTrademarResponseData extends ResponseData {
  data: TrademarkListData
}

export type TrademarkListData = TrademarkList[]

export interface TrademarkList {
  createTime?: string
  id: number | string
  logoUrl: string
  tmName: string
  updateTime?: string
}

export interface HasSpuImageResponseData extends ResponseData {
  data: ImageList
}

export type ImageList = ImageListData[]

export interface ImageListData {
  id?: number | string
  createTime?: string
  updateTime?: string
  spuId?: number
  imgName?: string
  imgUrl?: string
  name?: string
  url?: string
  response?: {
    code?: number
    data?: string
    message?: string
    ok?: boolean
  }
}

export interface HasSpuSaleAttrResponseData extends ResponseData {
  data: SaleAttrData
}

export type SaleAttrData = SaleAttr[]

export interface SaleAttr {
  id?: number
  createTime?: null
  updateTime?: null
  spuId: number
  baseSaleAttrId: number
  saleAttrName: string
  spuSaleAttrValueList: SaleAttrValueListData[]
  flag?: boolean
  saleAttrValue?: string | undefined
  saleIDAndValueId: string
}

export type SaleAttrValueListData = SaleAttrValueList[]

export interface SaleAttrValueList {
  id?: number
  createTime?: null
  updateTime?: null
  spuId?: number
  baseSaleAttrId: number
  saleAttrValueName: string
  saleAttrName?: string
  isChecked?: null
}

export interface HasAllSaleAttrResponseData extends ResponseData {
  data: BaseSaleAtrrListData
}

export type BaseSaleAtrrListData = BaseSaleAtrrList[]

export interface BaseSaleAtrrList {
  id: number
  createTime?: string
  updateTime?: string
  name: string
}

export interface AddSpuAndUpdataResponseData extends ResponseData {
  data: SpuRecord
}

export interface FindSpuIdHasSkuInfoResponseData extends ResponseData {
  data: Sku
}
export type Sku = SkuData[]

export interface SkuData {
  category3Id: number | string
  createTime?: string
  id?: number
  isSale?: number
  price: number | string
  skuAttrValueList: SkuAttrValueListData[]

  skuDefaultImg: number | string
  skuDesc: number | string
  skuImageList?: SkuImageListData[]
  skuName: string
  skuSaleAttrValueList: SkuSaleAttrValueListData[]

  spuId: number | string
  tmId: number | string
  updateTime?: string
  weight: string
}

export type SkuSaleAttrValueListData = SkuSaleAttrValueList[]

export interface SkuSaleAttrValueList {
  createTime?: string
  id?: number
  saleAttrId: number
  saleAttrName?: string
  saleAttrValueId: number
  saleAttrValueName?: string
  skuId?: number
  spuId?: number
  updateTime?: string
}

export type SkuImageListData = SkuImageList[]

export interface SkuImageList {
  createTime: string
  id: number
  imgName: string
  imgUrl: string
  isDefault: string
  skuId: number
  spuImgId: number
  updateTime: string
}

export type SkuAttrValueListData = SkuAttrValueList[]

export interface SkuAttrValueList {
  attrId: number
  attrName?: string
  createTime?: string
  id?: number
  skuId?: number
  updateTime?: string
  valueId: number
  valueName?: string
}
